HAL IRDA state and error functions migration

This section provides information about the HAL IRDA state and error functions migration.

HAL IRDA get state

In HAL2, Separate functions are added for specific state machines:
  • HAL_UART_GetTxState() to check the transmission state.

  • HAL_UART_GetRxState() to check the reception state.

HAL1

HAL2

HAL_IRDA_GetState(IRDA_HandleTypeDef *hirda)
HAL_UART_GetState  (const hal_uart_handle_t *huart)
HAL_UART_GetTxState(const hal_uart_handle_t *huart)
HAL_UART_GetRxState(const hal_uart_handle_t *huart)

Related concepts: Revised and optimized HAL state machine


HAL IRDA get error

HAL1

HAL2

Description

In HAL1, the function HAL_IRDA_GetError() returns the UART error code. The UART error code can be a combination (bitfields) of the following values:

  • HAL_IRDA_ERROR_NONE

  • /*

  • HAL_IRDA_ERROR_PE

  • HAL_IRDA_ERROR_NE

  • HAL_IRDA_ERROR_FE

  • HAL_IRDA_ERROR_ORE

  • HAL_IRDA_ERROR_DMA

  • /*

  • HAL_IRDA_ERROR_INVALID_CALLBACK

In HAL2, the function HAL_UART_GetLastErrorCodes() retrieves the last error codes for the UART. The UART last error codes can be a combination (bitfields) of the following values:

  • HAL_UART_RECEIVE_ERROR_NONE

  • HAL_UART_TRANSMIT_ERROR_NONE

  • HAL_UART_RECEIVE_ERROR_PE

  • HAL_UART_RECEIVE_ERROR_NE

  • HAL_UART_RECEIVE_ERROR_FE

  • HAL_UART_RECEIVE_ERROR_ORE

  • HAL_UART_RECEIVE_ERROR_RTO

  • HAL_UART_RECEIVE_ERROR_DMA

  • HAL_UART_TRANSMIT_ERROR_DMA

Function name

HAL_IRDA_GetError(IRDA_HandleTypeDef *hirda);
HAL_UART_GetLastErrorCodes(const hal_uart_handle_t *huart);

Note

In HAL2, the constant HAL_IRDA_ERROR_INVALID_CALLBACK has been removed. Instead, functions HAL_UART_RegisterXXXCallback() return HAL_INVALID_PARAM in case of an invalid callback pointer.

Related concepts: Revised and optimized HAL error management